package com.nsl.my_youlai.Jackson.online2_ok;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;


@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@JsonDeserialize(using = CustomEnumDeserializer.class)
public enum Distance {
    KILOMETER("km", 1000), 
    MILE("miles", 1609.34),
    METER("meters", 1), 
    INCH("inches", 0.0254),
    CENTIMETER("cm", 0.01), 
    MILLIMETER("mm", 0.001);
 
    private String unit;
    private final double meters;

    public double getMeters() {
        return meters;
    }

//    @JsonValue
    public String getUnit() {
        return unit;
    }

    private Distance(String unit, double meters) {
        this.unit = unit;
        this.meters = meters;
    }
 
    // standard getters and setters
}